package com.lighting.common.feign.search.api;

import com.lighting.common.core.vo.Result;
import com.lighting.common.feign.search.dto.*;
import com.lighting.common.feign.search.dto.inside.*;
import com.lighting.common.feign.search.vo.SearchPage;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface SearchApi {

    @PostMapping("/save")
    Result save(@RequestBody SaveDto dto);

    @PostMapping("/updateById")
    Result updateById(@RequestBody UpdateDto dto);

    @PostMapping("/updateByQuery")
    Result updateByQuery(@RequestBody UpdateDto dto);

    @PostMapping("/findById")
    Result<Map> findById(@RequestBody GetDto dto);

    @PostMapping("/findList")
    Result<List<Map>> findList(@RequestBody Query query);

    @PostMapping("/findPage")
    Result<SearchPage<Map>> findPage(@RequestBody PageQuery query);

    @PostMapping("/aggregation")
    Result<BigDecimal> aggregation(@RequestBody AggregationQuery query);

    @PostMapping("/aggregationList")
    Result<List<List<Object>>> aggregationList(@RequestBody AggregationQuery query);

    @DeleteMapping("/delete")
    Result<Void> delete(@RequestBody DeleteDto dto);

    @DeleteMapping("/deleteByQuery")
    Result<Void> deleteByQuery(@RequestBody Query query);

    @PutMapping("/putMapping")
    Result<Void> putMapping(@RequestBody MappingDto dto);
}
